<template>
<div>
<!-- 头部组件 -->
<detail-header :name="name" :banner="banner" :gallery="gallery"></detail-header>
<!-- 去哪儿推荐 -->
<DetailRecommend :list="lastList"></DetailRecommend>
<!-- 门票组件 -->
<admission-ticket></admission-ticket>
<!-- 成人票组件 -->
<adult-ticket :ticketList="ticketList"></adult-ticket>
<!-- 门票场次 -->
<scene></scene>
<!-- 用户评论 -->
<detail-comment :GalleryTwo="GalleryTwo"></detail-comment>
</div>
</template>

<script>
import axios from 'axios'
import DetailHeader from './components/Header.vue'
import AdmissionTicket from './components/Ticket.vue'
import AdultTicket from './components/AdultTicket.vue'
import Scene from './components/Scene.vue'
import DetailComment from './components/Comment.vue'
import DetailRecommend from './components/Recommend.vue'
export default {
  name: 'detail',
  components: {
    DetailHeader,
    AdmissionTicket,
    AdultTicket,
    Scene,
    DetailComment,
    DetailRecommend
  },
  data () {
    return {
      name: '',
      banner: '',
      gallery: [],
      ticketList: [],
      GalleryTwo: [],
      lastList: []
    }
  },
  methods: {
    handleSuccess (res) {
      let dataObj = res.data
      if (dataObj.ret && dataObj.data) {
        let dataList = dataObj.data
        this.name = dataList.sightName
        this.banner = dataList.bannnerImg
        this.gallery = dataList.galleryImgs
        this.lastList = dataList.lastList
        this.ticketList = dataList.ticketList
        this.GalleryTwo = dataList.GalleryTwo
      }
    }
  },
  mounted () {
    axios.get('/localdata/detail.json', {
      prams: {
        id: this.$route.params.id
      }
    })
      .then((res) => {
        this.handleSuccess(res)
      })
      .catch((err) => {
        console.log(err)
      })
  }
}
</script>

<style lang="stylus" scoped="scoped">
</style>
